import {baseUrl} from "@/config/env";
import startSearchModel from "@/config/startSearchModel";

export default () => {
    return {
        submitText: '修改',
        size: 'default',
        labelWidth: 110,
        index: true,
        menuAlign: 'center',
        menuPosition: "right",
        searchIndex: 3,
        searchMenuSpan: 6,
        searchIcon: true,
        menuType: "menu",
        viewBtn: true,
        permissionBtn: {
            addBtn: 'start:quartz:add',
            editBtn: 'start:quartz:edit',
            viewBtn: 'start:quartz:info',
            delBtn: 'start:quartz:delete',
        },
        column: [
            {
                "display": false,
                "label": "id",
                "prop": "id",
                "hide": true,
                "type": "input"
            },
            {
                "addDisplay": true,
                "editDisplay": false,
                "label": "任务组",
                "prop": "taskGroupKey",

                search: true,
                span: 24,
                "type": "select",
                dicUrl: baseUrl + "/start/sysDictionaryItem/listByDictionaryCode",
                dicMethod: "get",
                dicQuery: {dictCode: "quartz_timer_group"},
                filterable: true,
                props: {
                    label: 'dictName',
                    value: 'id',
                },
                rules: [
                    {required: true, message: "请选择任务组"}
                ]
            },
            {
                "addDisplay": true,
                "editDisplay": true,
                "label": "任务名称",
                "prop": "taskName",
                "showColumn": true,
                "type": "input",
                search: true,
                searchModel: startSearchModel.LIKE,
                maxlength: 50,
                rules: [
                    {required: true, message: "请输入任务名称"},

                ]
            },
            {
                "addDisplay": true,
                "editDisplay": true,
                "label": "任务编码",
                "prop": "taskCode",
                "showColumn": true,
                "type": "input",
                search: true,
                searchModel: startSearchModel.LIKE,
                maxlength: 50,
                rules: [
                    {required: true, message: "请输入任务编码"},
                ]
            },

            {
                "addDisplay": true,
                "editDisplay": false,
                "label": "执行类型",
                "prop": "taskExecuteType",
                "showColumn": true,
                search: true,
                "type": "select",
                span: 24,
                dicData: [
                    {label: "bean对象方法", value: 0},
                    {label: "任务执行class", value: 1},
                ],
                control: (val, form) => {
                    let result = {};
                    result.taskExecuteObj = {}

                    if (val === null || val === undefined) {
                        result.taskExecuteObj.tip = "示例：com.start.quartz.tasks.TestClassJob";
                    } else {
                        result.taskExecuteObj.tip = "示例：testBeanJob.testJob()";
                    }
                    return result;
                },

                rules: [
                    {required: true, message: "请选择任务执行类型"},
                ]
            },
            {
                "addDisplay": true,
                "editDetail": true,
                "label": "执行对象",
                "prop": "taskExecuteObj",
                "showColumn": true,
                "type": "input",
                search: true,
                searchModel: startSearchModel.LIKE,
                display: false,
                overHidden: true,
                maxlength: 100,
                rules: [
                    {required: true, message: "请输入任务执行对象"}
                ],
                span: 24,
            },
            {
                "label": "开始时间",
                "prop": "taskStartTime",
                "showColumn": true,
                "type": "datetime",
                format: "YYYY-MM-DD HH:mm:ss"
            },
            {

                "label": "结束时间",
                "prop": "taskEndTime",
                "showColumn": true,
                "type": "datetime",
                format: "YYYY-MM-DD HH:mm:ss"
            },
            {
                "addDisplay": true,
                "editDisplay": true,
                "label": "cron 表达式",
                "prop": "taskCron",
                span: 24,
                "showColumn": true,
                "type": "input",
                rules: [
                    {required: true, message: "请选择请输入任务定时表达式"},
                ]
            },

            {
                "addDisplay": true,
                "editDisplay": true,
                "label": "任务参数",
                "prop": "taskEnvData",
                "showColumn": true,
                "type": "monaco-edit",
                language: "json",
                options: {
                    minimap: {
                        enabled: false
                    }
                },
                hide: true,
                span: 24,
            },
            {
                "addDisplay": false,
                "editDisplay": false,
                "label": "上次执行时间",
                "prop": "prevFireTime",
                "showColumn": true,
                "type": "datetime",
                format: "YYYY-MM-DD HH:mm:ss"
            },
            {
                "addDisplay": false,
                "editDisplay": false,
                "label": "下次执行时间",
                "prop": "nextFireTime",
                "showColumn": true,
                "type": "datetime",
                format: "YYYY-MM-DD HH:mm:ss"
            },
            {
                "addDisplay": false,
                "editDisplay": false,
                "label": "状态",
                "prop": "taskStatus",
                "showColumn": true,
                "type": "radio",
                width: 60,
                value: 0,
                tag: true,
                tagProp: {
                    1: {type: "primary"},
                    0: {type: "info"},
                },
                dicData: [
                    {
                        label: "启用",
                        value: 1
                    }, {
                        label: "停止",
                        value: 0
                    },
                ]
            },

            {
                "addDisplay": false,
                "editDisplay": false,
                "label": "运行状态",
                "prop": "triggerState",
                "showColumn": true,
                "type": "select",
                width: 80,
                dicData: [
                    {label: "等待", value: "WAITING"},
                    {label: "暂停", value: "PAUSED"},
                    {label: "正在执行", value: "ACQUIRED"},
                    {label: "阻塞", value: "BLOCKED"},
                    {label: "错误", value: "ERROR"},
                ]
            },
            {
                "addDisplay": true,
                "editDisplay": true,
                "label": "描述信息",
                "prop": "taskDescribe",
                "showColumn": true,
                "type": "textarea",
                hide: true,
                span: 24,
                width: 120,
                showWordLimit: true,
                maxlength: 100,
            },

            {
                "display": false,
                "label": "创建人",
                "prop": "createBy",
                "hide": true,
                "type": "input"
            },
            {
                "display": false,
                "label": "创建时间",
                "prop": "createTime",
                "hide": true,
                "type": "datetime"
            },
            {
                "display": false,
                "label": "修改人",
                "prop": "updateBy",
                "hide": true,
                "type": "input"
            },
            {
                "display": false,

                "label": "修改时间",
                "prop": "updateTime",
                "hide": true,
                "type": "datetime"
            }]

    }
}
